﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Silvery.Role.Simple;

namespace Silvery.Role.Standard
{    
    /// <summary>
    /// 事件
    /// </summary>
    /// <param name="npc"></param>
    /// <param name="userstate"></param>
    public delegate void StandardNpcClickEventHandler(StandardNPC npc,object userstate);
    /// <summary>
    /// 标准的NPC
    /// </summary>
    public class StandardNPC : SimpleRole_NPC
    {
        public StandardNPC(Uri bodyUri)
            :base(bodyUri)
        {
            MouseEnterEffectOpened = true;
            MouseLeftButtonUp += new MouseButtonEventHandler(StandardNPC_MouseLeftButtonUp);
        }
        /// <summary>
        /// 点击事件
        /// </summary>
        public event StandardNpcClickEventHandler StandardNpcClick;
        void StandardNPC_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            OnStandardNpcClick(this, null);
        }
        /// <summary>
        /// 当点击时候的触发
        /// </summary>
        /// <param name="npc"></param>
        /// <param name="userstate">自定义信息</param>
        protected virtual void OnStandardNpcClick(StandardNPC npc, object userstate)
        {
            if (StandardNpcClick != null)
                StandardNpcClick(this, userstate);
        }
        /// <summary>
        /// 销毁
        /// </summary>
        public override void Dispose()
        {
            MouseLeftButtonUp -= StandardNPC_MouseLeftButtonUp;
            base.Dispose();
        }
    }
}
